package com.xmotor.test_base64;

import java.util.Base64;

public class Base64Utils {
    /**
     * base64编码
     */
    public static String encodeBase64(String str){
        byte[] bytes = str.getBytes();
        return Base64.getEncoder().encodeToString(bytes);
    }

    /**
     * base64解码
     */
    public static String decodeBase64(String str){
        byte[] decode = Base64.getDecoder().decode(str);
        return new String(decode);
    }
}
